package extra01GUI;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Ventana extends JFrame implements ActionListener {
		
	private JButton btnAccion;
	private JComboBox cbLista;

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public Ventana(){
		super("Firguras Geometricas");
		
		btnAccion = new JButton("Generar");
		btnAccion.addActionListener(this);
		
		cbLista = new JComboBox(new String[] {"Circulo","Rectangulo","Triangulo"});
		
		setLayout(new FlowLayout());
		add(cbLista);
		add(btnAccion);
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
		Point punto = ge.getCenterPoint();
		setLocation(punto.x-200, punto.y-100);

	}

	public void Iniciar(){
		pack();
		setSize(230, 75);
		setResizable(false);
		setVisible(true);
	}
	
	@Override
 	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		switch	(cbLista.getSelectedIndex()){
		case 0:
			VCirculo vc = new VCirculo(this);
			vc.Iniciar();
			break;
		case 1:
			VRectangulo vr = new VRectangulo(this);
			vr.Iniciar();
			break;
		case 2:
			VTriangulo vt = new VTriangulo(this);
			vt.Iniciar();
			break;			
		default:
			break;
		}

	}

}
